

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Code Editors [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, Code Editor, Common,Code Editor, Common Bookmarks,Code Editor, Common Cursor History,Code Editor, Common Automatic Indentation,Code Editor, Common Brace/Bracket Matching,Code Editor, Common Commenting,Code Editor, Common Scope Guides,Code Editor, Common Zooming,Code Editor, Common Line Selection,Code Editor, Common Configuration,Bookmarks,Bookmarks Code Editor, Common,Cursor History,Cursor History Code Editor, Common,Brace/Bracket Matching,Brace/Bracket Matching Code Editor, Common,Commenting,Commenting Code Editor, Common,Automatic Indentation,Automatic Indentation Code Editor, Common,Scope Guides,Scope Guides Code Editor, Common,Zooming,Zooming Code Editor, Common,Configuration,Configuration Code Editor, Common,Line Selection,Line Selection Code Editor, Common">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Code Editors</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="the_pan__zoom_window.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="intellisense.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_TextIndentedL1"><img src="code_editor.png" width="389" height="103" border="0" alt="code_editor"></p>
<p class="p_BodyText"><span class="f_BodyText">Enterprise Architect provides a number of editors that you can use to maintain scripts, code and templates. Specifically, these are the:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1"><a href="shape_editor.htm">Shape Script Editor*</a></span></li>
<li><span class="f_Bulletlist1"><a href="thecodetemplateeditor.htm">Code Generation Template Editor</a></span></li>
<li><span class="f_Bulletlist1"><a href="transformationtemplates.htm">Transformation Template Editor</a></span></li>
<li><span class="f_Bulletlist1"><a href="creating_filters.htm#SQL">Custom SQL Search Filter Editor*</a></span></li>
<li><span class="f_Bulletlist1"><a href="views.htm">Database View Editor*</a></span></li>
<li><span class="f_Bulletlist1"><a href="webtemplate.htm">HTML Report Template Editor</a></span></li>
<li><span class="f_Bulletlist1"><a href="thesourcecodeviewer.htm">Source Code Editor*</a></span></li>
<li><span class="f_Bulletlist1"><a href="script_editors.htm">Script Editor*</a></span></li>
</ul>
<p class="p_BodyText"><span class="f_BodyText">Each editor has its own features, but they are all based on a common </span><span class="f_BodyText" style="font-style: italic;">Code Editor </span><span class="f_BodyText">c</span><span class="f_BodyText">ontrol</span><span class="f_BodyText">. </span></p>
<p class="p_BodyText"><span class="f_BodyText">The Code Editor provides a variety of functions to assist with the code editing process, including:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1"><a href="code_editors.htm#Books">Bookmarks</a></span></li>
<li><span class="f_Bulletlist1"><a href="code_editors.htm#Cursor">Cursor history</a></span></li>
<li><span class="f_Bulletlist1"><a href="code_editors.htm#Bracket">Brace matching</a></span></li>
<li><span class="f_Bulletlist1"><a href="code_editors.htm#Indent">Automatic indentation</a></span></li>
<li><span class="f_Bulletlist1"><a href="code_editors.htm#Comment">Commenting selections</a></span></li>
<li><span class="f_Bulletlist1"><a href="code_editors.htm#Scope">Scope guides</a></span></li>
<li><span class="f_Bulletlist1"><a href="code_editors.htm#Zoom">Zooming</a></span></li>
<li><span class="f_Bulletlist1"><a href="code_editors.htm#Line">Line selection</a></span></li>
<li><span class="f_Bulletlist1"><a href="intellisense.htm">Intellisense</a>.</span></li>
</ul>
<p class="p_BodyText"><span class="f_BodyText">A range of these functions is available through keyboard key combinations; see the </span><span class="f_BodyText" style="font-style: italic;"><a href="code_editor_key_bindings.htm">Code Editor Key Bindings</a></span><span class="f_BodyText"> topic.</span></p>
<p class="p_BodyText"><span class="f_BodyText">You can customize several of the Code Editor features by setting properties in the Code Editor configuration files. For more information see the </span><span class="f_BodyText" style="font-style: italic;">Code Editor Configuration Guide</span><span class="f_BodyText"> located as an RTF file in the </span><span class="f_BodyText" style="font-style: italic;">Config</span><span class="f_BodyText"> directory under the Enterprise Architect installation directory.</span><a name="config"></a></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Bookmarks<a name="books"></a></span></p>
<p class="p_BodyText"><span class="f_BodyText">Bookmarks denote a line of interest in the document. You can toggle them on and off for a particular line by pressing </span><span class="f_MenuKeyField">[Ctrl]+[F2]</span><span class="f_BodyText">. Additionally, you can press </span><span class="f_MenuKeyField">[F2] </span><span class="f_BodyText">and </span><span class="f_MenuKeyField">[Shift]+[F2]</span><span class="f_BodyText"> to navigate to the next or previous bookmark in the document. </span></p>
<p class="p_BodyText"><span class="f_BodyText">In the following diagram, a bookmark has been set on line 74.</span></p>
<p class="p_TextIndentedL2"><img src="bookmark.png" width="696" height="305" border="0" alt="bookmark"></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Cursor History<a name="cursor"></a></span></p>
<p class="p_BodyText"><span class="f_BodyText">The Code Editor Control keeps a history of the previous 50 cursor positions. An entry in the history list is created when:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1">The cursor is moved more than 10 lines from its previous position</span></li>
<li><span class="f_Bulletlist1">The cursor is moved in a find/replace operation.</span></li>
</ul>
<p class="p_BodyText"><span class="f_BodyText">You can navigate to an earlier point in the cursor history by pressing</span><span class="f_MenuKeyField"> [Ctrl]+[-]</span><span class="f_BodyText">, and a to later point by pressing </span><span class="f_MenuKeyField">[Ctrl]+[Shift]+[-]</span><span class="f_BodyText">.</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Brace/Bracket Matching<a name="bracket"></a></span></p>
<p class="p_BodyText"><span class="f_BodyText">When you place the cursor over a brace or bracket, the Code Editor highlights its corresponding partner. You can then navigate to the matching brace by pressing</span><span class="f_MenuKeyField"> [Ctrl]+[E]</span><span class="f_BodyText">.</span></p>
<p class="p_TextIndentedL2"><img src="bracematch.zoom100.png" width="669" height="202" border="0" alt="braceMatch"></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Automatic Indentation<a name="indent"></a></span></p>
<p class="p_BodyText"><span class="f_BodyText">For each supported language, the Code Editor adjusts the indentation of a new line according to the presence of control statements or scope block tokens in the lines leading up to the cursor position.</span></p>
<p class="p_BodyText"><span class="f_BodyText">For more information on customizing automatic indentation for a language, see the <a href="code_editors.htm#Config">Configuration</a> section.</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Commenting Selections<a name="comment"></a></span></p>
<p class="p_BodyText"><span class="f_BodyText">For languages that support comments, the Code Editor can comment entire selections of code. The Code Editor recognizes two types of commenting:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1">Line Commenting - entire lines are commented from the start (e.g. </span><span class="f_Code">// This is a comment</span><span class="f_Bulletlist1">)</span></li>
<li><span class="f_Bulletlist1">Stream Commenting - sections of a line are commented from a specified start point to a specified end point (e.g. </span><span class="f_Code">/* This is a comment */</span><span class="f_Bulletlist1">).</span></li>
</ul>
<p class="p_BodyText"><span class="f_BodyText">You can toggle comments on the current line or selection by pressing</span><span class="f_MenuKeyField"> [Ctrl]+[Shift]+[C] </span><span class="f_BodyText">for line comments, or </span><span class="f_MenuKeyField">[Ctrl]+[Shift]+[X]</span><span class="f_BodyText"> for stream comments.</span></p>
<p class="p_TextIndentedL2"><img src="linecommentselection.png" width="656" height="340" border="0" alt="lineCommentSelection"></p>
<p class="p_BodyText"><span class="f_BodyText">For more information on customizing selection commenting for each language, see the <a href="code_editors.htm#Config">Configuration</a> section.</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Scope Guides<a name="scope"></a></span></p>
<p class="p_BodyText"><span class="f_BodyText">If the mouse is placed over an indentation marker, the Code Editor performs a 'look back' to find the line that started the scope at that indentation level. If the line is found and is currently on screen, it is highlighted in light blue. </span></p>
<p class="p_TextIndentedL2"><img src="scopeguideonscreen.png" width="751" height="228" border="0" alt="scopeGuideOnScreen"></p>
<p class="p_BodyText"><span class="f_BodyText">Alternatively if the line is off screen, a calltip is displayed advising of the line number and contents. </span></p>
<p class="p_TextIndentedL2"><img src="scopeguideoffscreen.png" width="753" height="219" border="0" alt="scopeGuideOffScreen"></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Zooming<a name="zoom"></a></span></p>
<p class="p_BodyText"><span class="f_BodyText">You can zoom into and out of the contents of the Code Editor using </span><span class="f_MenuKeyField">[Ctrl]+mousewheel</span><span class="f_BodyText"> or </span><span class="f_MenuKeyField">[Ctrl]+keypad[+]</span><span class="f_BodyText"> / </span><span class="f_MenuKeyField">[Ctrl]+keypad[-]</span><span class="f_BodyText">. Zoom can be restored to 100% by using </span><span class="f_MenuKeyField">[Ctrl]+keypad[/]</span><span class="f_BodyText">.</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Line Selection<a name="line"></a></span></p>
<p class="p_BodyText"><span class="f_BodyText">If you want to move the cursor to a specific line of code, press </span><span class="f_MenuKeyField">[Ctrl]+[G]</span><span class="f_BodyText"> and, in response to the prompt, type in the line number. Press the </span><span class="f_MenuKeyField">OK</span><span class="f_BodyText"> button. The editor displays the specified line of code with the cursor at the left.</span></p>
<p style="margin: 0px 0px 0px 0px;"><span style="font-size: 12pt; font-family: 'Times New Roman'; color: #000000;">&nbsp;</span></p>




            </div>
          </div>
        </div>



</div>


</body>
</html>
